
var PI = Math.PI;
var e0;
var e176;
var e169;
var e170;
var e180;

var e3;
var e5;

var e40 = new Array;
var e43 = new Array;
var e44 = new Array;

var e45 = new Array;
var e46 = [3*PI/4,PI/4,40,0,0,0];
var e47 = new Array;
var e48 = new Array;
var e49;
var e50 = new Array;
var e51;

var e52 = 1.7;
var e53 = 0.005;
var e186;
var e54 = new Array;
var e178 = false;

var cubeFinished = false;
var e58 = new Array ;
var e219;
var e164 = 3000;
var materialUrls = [
	"../ishader/texture-colormult.shader"
	];
var textures = new Array;
var textureUrls = [
					"../ipic/menu_blank.png"
					];


window.onunload = uninit;

function init(){
	o3djs.util.makeClients(e165);
	}
	
function uninit() {
    if (e176) {
   		e176.cleanup();
  		}
	}

function e165(clientElements){
	e0 = clientElements[0];
	e176 = e0.client;
	e169 = e0.o3d;
	e180 = o3djs.math;
	e170 = e176.createPack(); 
	
	e40.transform = e170.createObject("Transform");
	e40.transform.parent = e176.root;
	
	e40.x = 0;
	e40.y = 0;
	e40.z = 0;
	e40.localX = 0;
	e40.localY = 0;
	e40.localZ = 0;
	e58.push(e40);
	
	e43.transform = e170.createObject("Transform");
	e43.transform.parent = e176.root;

	initEye();
	initViewInfo();	
	e166();
	e44[0] = new e110.e154();
	}
	
function e166(){
	var loader = o3djs.loader.createLoader(e177);
	var textureLinkName;
	for(var n=0;n<textureUrls.length;n++){
		textureLinkName = textureUrls[n];
		textureLinkName = cutUrlToSingle(textureLinkName);
		textures[textureLinkName] = textureUrls[n];
		loadTexture(loader,textureLinkName);
		}
	loader.finish();
	}

function loadTexture(loader,urlObj){
	loader.loadTexture(e170, textures[urlObj], function(texture, exception) {
					   if (exception) {
					   alert(exception);
					   }
					   else {
					   textures[urlObj] = texture;}});
	}
	

function e177(){
	
	e14.init();
	initEvent();
	cubeFinished = true;
	loadModel();
	
	}
	
function cutUrlToSingle(url){
	var subNum = url.indexOf("/");
	var subUrl = url.slice(subNum + 1);
	subNum = subUrl.indexOf("/");
	if(subNum == -1){
		subNum = subUrl.indexOf(".");
		subUrl = subUrl.slice(0,subNum);
		return  subUrl;
		}
		else{
			return cutUrlToSingle(subUrl);
			}
	
	}	

function initEye(){
	e48[0] = e46[0];
	e48[1] = e46[1];
	e49 = e46[2];
	e50[0] = e46[3];
	e50[1] = e46[4];
	e50[2] = e46[5];
	e47[2] = e49*Math.cos(e48[1])*Math.sin(e48[0]) + e50[2];
	e47[1] = e49*Math.sin(e48[1]) + e50[1];
	e47[0] = e49*Math.cos(e48[1])*Math.cos(e48[0]) + e50[0];
	}
	
function initViewInfo(){
	e3 = o3djs.rendergraph.createBasicView(e170,
												 e40.transform,
												 e176.renderGraphRoot);
	e3.drawContext.projection = e180.matrix4.perspective(e180.degToRad(30),
																	  e176.width/e176.height,
																	  1,
																	  2000);
	e3.drawContext.view = e180.matrix4.lookAt(e47,
														e50,
														[0,1,0]);
	
	e3.clearBuffer.clearColorFlag = false;
	
	e5 = o3djs.rendergraph.createBasicView(e170,
													 e43.transform,
													 e176.renderGraphRoot);
	e5.drawContext.projection = e180.matrix4.orthographic(0.5,
																	   e176.width + 0.5,
																	   e176.height + 0.5,
																	   0.5,
																	   100,
																	   1000);
	e5.drawContext.view = e180.matrix4.lookAt( [0, 0, 1],
															[0, 0, 0],
															[0, 1, 0]);
	
	e5.root.priority = e3.root.priority - 1;
	e5.clearBuffer.clearColorFlag = false;
	e5.zOrderedState.getStateParam("CullMode").value = e169.State.CULL_NONE;
	e5.zOrderedState.getStateParam("ZWriteEnable").value = false;
	}

function initEvent(){
	o3djs.event.addEventListener(e0,"mousedown",e208.startDragging);
	o3djs.event.addEventListener(e0,"mousemove",e208.drag);
	o3djs.event.addEventListener(e0,"mouseup",e208.stopDragging);
	o3djs.event.addEventListener(e0,"wheel",e208.e251);
	o3djs.event.addEventListener(e0,"keydown",e208.keyDown);
	o3djs.event.addEventListener(e0,"dblclick",e208.e209);
	}
	
	

var e208 = e208 || {};

e208.startDragging = function(E){
	e45[0] = e45[2] = E.x;
	e45[1] = e45[3] = E.y;	
	e45[4] = e45[10] = e48[0];
	e45[5] = e45[11] = e48[1];
	e45[6] = e49;
	e45[7] = e50[0];
	e45[8] = e50[1];
	e45[9] = e50[2];
	e176.cursor = e169.Cursor.DEFAULT;
	
	if(E.button == 0){
		e54["rotation"] = true;
		}
	else if (E.button == 1){
		e54["move"] = true;
		}
	else if (E.button == 2){
		e54["rotation"] = true;
		}
	e178 = true;
	}

e208.drag = function(E){
		e45[2] = E.x;
		e45[3] = E.y;
		e176.cursor = e169.Cursor.DEFAULT;
			if (e54["move"]){
				e51 = null;
				var rY = (e45[3] - e45[1]) * e53 * e45[6] * 0.1;
				var aY = e45[4] - PI;
				var bY = PI/2 - e45[5];
				var rX = (e45[0] - e45[2]) * e53 * e45[6] * 0.1;
				var aX = e45[4] - PI/2;
				var targetZ = rY*Math.cos(bY)*Math.sin(aY) + rX*Math.sin(aX) + e45[9];
				var targetY = rY*Math.sin(bY) + e45[8];
				var targetX = rY*Math.cos(bY)*Math.cos(aY) + rX*Math.cos(aX) + e45[7];
				view.e6([targetX,targetY,targetZ]);
				}
				else if (e54["rotation"]){
					e51 = null;
					var angleAfter = new Array;
					angleAfter[0]  = (e45[2]-e45[0]) * e53 + e45[4];
					var angleTest =  (e45[3]-e45[1]) * e53 + e45[5];
					if (angleTest >= 0){
						angleAfter[1] = Math.abs(angleTest)>PI/2 - 0.001 ? PI/2 - 0.001: angleTest;
						}
						else{
							angleAfter[1] = Math.abs(angleTest)>PI/2 - 0.001 ? -PI/2 + 0.001: angleTest;
							}
					view.e7(angleAfter);
					}
	}

e208.stopDragging = function(E){
		e48[0] = view.PiRound(e48[0]);
		e48[1] = view.PiRound(e48[1]);
		e178 = false;
		e176.cursor = e169.Cursor.DEFAULT;
		e54["move"] = false;
		e54["rotation"] = false;
		e54["zoomfalse"] = false;
	}

e208.e251 = function(E){
	if(!e54["zoomfalse"]){
			e54["zoomfalse"] = true;
			var zoom = (E.deltaY>0) ? 1/e52 : e52;
			view.e8(e49*zoom,15);
			e51 = null;
		}
	}


e208.keyDown = function(E){
			switch(E.keyCode){
				case 32: 
					view.e10();
					break;
				case 38:
					e18.e257();
					break;
				case 37:
					e18.e258();
					break;
				case 40:
					e18.e228();
					break;
				case 39:
					e18.e243();
					break;
				}
			

	}


e208.e209 = function(){
	view.e10();
	}

var e18 = e18 || {};

e18.e257 = function(){
	var e264 = [PI/2,PI/2-0.001,e49,e50[0],e50[1],e50[2]];
	view.e13(e264,30);
	}
	
e18.e228 = function(){
	var e264 = [PI/2,0,e49,e50[0],e50[1],e50[2]];
	view.e13(e264,30);
	}	
	
e18.e258 = function(){
	var e264 = [PI,0,e49,e50[0],e50[1],e50[2]];
	view.e13(e264,30);
	}
	
e18.e243 = function(){
	var e264 = [PI*3/4,PI/4,e49,e50[0],e50[1],e50[2]];
	view.e13(e264,30);
	}	




var view = view || {};
 

view.e6 = function(centerAfter,e235){
	clearInterval(e186);
	if (!e235){
		e47[0] = e47[0] + centerAfter[0] - e50[0];
		e50[0] = centerAfter[0];	
		e47[1] = e47[1] + centerAfter[1] - e50[1];
		e50[1] = centerAfter[1];
		e47[2] = e47[2] + centerAfter[2] - e50[2];
		e50[2] = centerAfter[2];
		e3.drawContext.view = e180.matrix4.lookAt(
															e47,
															e50,
															[0,1,0]
															 );
		e83.e225();
		e186 = null;
		}
		else{
			var e247 = [e47[0],e47[1],e47[2],e50[0],e50[1],e50[2]];
			var centerL = new Array;
			centerL[0] = centerAfter[0] - e50[0];
			centerL[1] = centerAfter[1] - e50[1];
			centerL[2] = centerAfter[2] - e50[2];
			var n = 0;							
			e186 = setInterval(function(){view.e240(e247,centerL,n,e235);n++;},10);
			}
	}
	
view.e240 = function(e247,centerL,n,e235){
		e47[0] = e247[0] + Math.sin(PI/2*n/e235)*centerL[0];
		e50[0] = e247[3] + Math.sin(PI/2*n/e235)*centerL[0];	
		e47[1] = e247[1] + Math.sin(PI/2*n/e235)*centerL[1];
		e50[1] = e247[4] + Math.sin(PI/2*n/e235)*centerL[1];
		e47[2] = e247[2] + Math.sin(PI/2*n/e235)*centerL[2];
		e50[2] = e247[5] + Math.sin(PI/2*n/e235)*centerL[2];
							e3.drawContext.view = e180.matrix4.lookAt(
																			  e47,
																			  e50,
																			  [0,1,0]
																		  );
		e83.e225();
		if (n>=e235){
		clearInterval(e186);
		e186 = null;
		}
	}
	
view.PiRound = function(rad){
	if (rad>PI){
		rad -= 2*PI;
		}
		else if(rad<=-PI){
				rad += 2*PI;
			}
		return rad;
	}

view.e7 = function(angleAfter,e235){
	clearInterval(e186);
	if (!e235){
				e48 = angleAfter;
				e47[2] = e49*Math.cos(e48[1])*Math.sin(e48[0]) + e50[2];
				e47[1] = e49*Math.sin(e48[1]) + e50[1];
				e47[0] = e49*Math.cos(e48[1])*Math.cos(e48[0]) + e50[0];
				e3.drawContext.view = e180.matrix4.lookAt(
																  e47,
																  e50,
																  [0,1,0]
																  );
		e83.e225();
		e186 = null;
		}
		else{
			var angleBefore = e48;
			var angleL = new Array;
			angleL[0] = angleAfter[0] - angleBefore[0];
			angleL[1] = angleAfter[1] - angleBefore[1];
			var n = 0;
			e186 = setInterval(function(){angleSmooth(angleBefore,angleL,n,e235);n++;},10);
			}
	}
	
view.e8 = function(eyeRAfter,e235){
	clearInterval(e186);
	if(!e235){
		e49 = eyeRAfter;
		e49 = e49 < 3 ? 3 : e49;
		e47[2] = e49*Math.cos(e48[1])*Math.sin(e48[0]) + e50[2];
		e47[1] = e49*Math.sin(e48[1]) + e50[1];
		e47[0] = e49*Math.cos(e48[1])*Math.cos(e48[0]) + e50[0];
		e3.drawContext.view = e180.matrix4.lookAt(
														  e47,
														  e50,
														  [0,1,0]
														  );
		e83.e225();
		e186 = null;
		}
		else{
			var eyeRBefore = e49;
			var rL = eyeRAfter - eyeRBefore;
			var n = 0;
			e186 = setInterval(function(){view.e242(eyeRBefore,rL,n,e235);n++;},10);
			}	
	}


view.e242 = function(eyeRBefore,rL,n,e235) {
	e49 = eyeRBefore + Math.sin(PI/2*n/e235)*rL;
    e49 = e49 < 3 ? 3 : e49;
	e47[2] = e49*Math.cos(e48[1])*Math.sin(e48[0]) + e50[2];
	e47[1] = e49*Math.sin(e48[1]) + e50[1];
	e47[0] = e49*Math.cos(e48[1])*Math.cos(e48[0]) + e50[0];
    e3.drawContext.view = e180.matrix4.lookAt(
													  e47,
													  e50,
													  [0,1,0]
													  );
		e83.e225();
		if (n>=e235){
		clearInterval(e186);
		e54["zoomfalse"] = false;
		e186 = null;
		}
	}

view.e9 = function(e72){
	var maxMinCoor = new Array;
	var returnMaxMin = new Array;
	
		for (var m=0;m<e72.length;m++){
			if (e72[m][0]){ 
							returnMaxMin = view.e9(e72[m]);
							}
							else{returnMaxMin[0] = e72[m].x;
								  returnMaxMin[1] = e72[m].x;
								  returnMaxMin[2] = e72[m].y;
								  returnMaxMin[3] = e72[m].y;
								  returnMaxMin[4] = e72[m].z;
								  returnMaxMin[5] = e72[m].z;
								}
			maxMinCoor[0] = maxMinCoor[0] == undefined ? returnMaxMin[0] : Math.max(maxMinCoor[0],returnMaxMin[0]);
			maxMinCoor[1] = maxMinCoor[1] == undefined ? returnMaxMin[1] : Math.min(maxMinCoor[1],returnMaxMin[1]);
			maxMinCoor[2] = maxMinCoor[2] == undefined ? returnMaxMin[2] : Math.max(maxMinCoor[2],returnMaxMin[2]);
			maxMinCoor[3] = maxMinCoor[3] == undefined ? returnMaxMin[3] : Math.min(maxMinCoor[3],returnMaxMin[3]);
			maxMinCoor[4] = maxMinCoor[4] == undefined ? returnMaxMin[4] : Math.max(maxMinCoor[4],returnMaxMin[4]);
			maxMinCoor[5] = maxMinCoor[5] == undefined ? returnMaxMin[5] : Math.min(maxMinCoor[5],returnMaxMin[5]);
					}
	return maxMinCoor;
	}

view.e10 = function(){
	if (e58[e58.length-1][0]){
		if (!e178){
			var maxMinCoor = view.e9(e58[e58.length-1]);
			var ax = maxMinCoor[0];
			var bx = maxMinCoor[1];
			var ay = maxMinCoor[2];
			var by = maxMinCoor[3];
			var az = maxMinCoor[4];
			var bz = maxMinCoor[5];	
			var targetR = Math.max( Math.max(Math.abs(ax-bx+1),Math.abs(ay-by+1)),Math.abs(az-bz+1))*2; 
			var targetX = (ax + bx)/2;
			var targetY = (ay + by)/2;
			var targetZ = (az + bz)/2;
			if (targetR<10){targetR = 10;}
			
			var eyeTar = [e48[0],e48[1],targetR,targetX,targetY,targetZ];
			if (!e51){
				e51 = [e48[0],e48[1],e49,e50[0],e50[1],e50[2]];
				view.e13(eyeTar,30);
				}
			else{
				view.e13(e51,30);
				e51 = null;
				}
			}
	}
	}

	
view.e13 = function(e264,e235){
		clearInterval(e186);
		var e235 = !e235 ? 50 : e235;
		var e247 = [e48[0],e48[1],e49,e50[0],e50[1],e50[2]];
		var aL = e264[0] - e48[0];
		if (aL>PI){
			aL -= 2*PI;
			}
			else if(aL<-PI){
				aL += 2*PI;
				}
		var bL = e264[1] - e48[1];
		var rL = e264[2] - e49;
		var xL = e264[3] - e50[0];
		var yL = e264[4] - e50[1];
		var zL = e264[5] - e50[2];
		var n = 0;
		e186 = setInterval(function(){view.e248(e247,aL,bL,rL,xL,yL,zL,n,e235);n++;},10);
	}


view.e248 = function(e247,aL,bL,rL,xL,yL,zL,n,e235){
	
	
	e48[0] = e247[0] + Math.sin(PI/2*n/e235)*aL;
	e48[1] = e247[1] + Math.sin(PI/2*n/e235)*bL;
	e49 = e247[2] + Math.sin(PI/2*n/e235)*rL;
	e50[0] = e247[3] + Math.sin(PI/2*n/e235)*xL;
	e50[1] = e247[4] + Math.sin(PI/2*n/e235)*yL;
	e50[2] = e247[5] + Math.sin(PI/2*n/e235)*zL;
	
	e47[2] = e49*Math.cos(e48[1])*Math.sin(e48[0]) + e50[2];
	e47[1] = e49*Math.sin(e48[1]) + e50[1];
	e47[0] = e49*Math.cos(e48[1])*Math.cos(e48[0]) + e50[0];
	
	e3.drawContext.view = e180.matrix4.lookAt(
													  e47,
													  e50,
													  [0,1,0]
													  );
		e83.e225();
	if (n>=e235){
		clearInterval(e186);
		e186 = null;
		}
	}
	
	
	
var e110 = e110 || {};

e110.e109 = function(cubeShape,colorRed,colorGreen,colorBlue,cubeAlpha,localX,localY,localZ,localL){
	
	var parent = e58[e58.length-1];
	var worldX = parent.x+localX;
	var worldY = parent.y+localY;
	var worldZ = parent.z+localZ;
	
		this.red = colorRed;
		this.green = colorGreen;
		this.blue = colorBlue;
		this.alpha = cubeAlpha;
		this.x = worldX;
		this.y = worldY;
		this.z = worldZ;
		this.l = localL
		this.localX = localX;
		this.localY = localY;
		this.localZ = localZ;
		this.parent = e58[e58.length-1];
		this.transform = e170.createObject("Transform");
		this.transform.parent = e58[e58.length-1].transform;
		this.transform.addShape(cubeShape);
		this.transform.translate(localX,
								 localY,
								 localZ);
		this.transform.scale(localL,
							 localL,
							 localL);
		this.transform.createParam("diffuse","ParamFloat4").value = [
																	 this.red,
																	 this.green,
																	 this.blue,
																	 this.alpha
																	 ];
	}
	
	
e110.e154 = function(){
	this.cubeMaterial = e170.createObject("Material");
	this.cubeMaterial.drawList = e3.zOrderedDrawList; 
	this.cubeMaterial.createParam("diffuse","ParamFloat4").value = [1,1,1,1];
	
	this.cubeMaterial.createParam("emissive", "ParamFloat4").value = [0, 0, 0, 1]; 
	this.cubeMaterial.createParam("ambient", "ParamFloat4").value = [0, 0, 0, 1];
	this.cubeMaterial.createParam("specular", "ParamFloat4").value = [1, 1, 1, 1];
	this.cubeMaterial.createParam("shininess", "ParamFloat").value = 100;
	this.cubeMaterial.createParam("specularFactor", "ParamFloat").value = 0.25;
	
	this.cubeMaterial.createParam("lightColor", "ParamFloat4").value = [1, 1, 1, 1]; 
	this.lightPositionParam = this.cubeMaterial.createParam("lightWorldPos", "ParamFloat3"); 
	this.lightPositionParam.value = e47;
	
	this.record = o3djs.effect.buildStandardShaderString(this.cubeMaterial,"phong"); 
	this.effect = e170.createObject("Effect");
	this.effect.name = this.record.description;
	this.effect.loadFromFXString(this.record.shader);
	this.cubeMaterial.effect = this.effect;
	this.effect.createUniformParameters(this.cubeMaterial); 

	var a = 1/2;
	this.positionArray = [	 -a, +a, +a,
 						     +a, +a, +a,
							 -a, -a, +a,
     						 +a, -a, +a,
 						     +a, +a, +a,
 						     +a, +a, -a,
 						     +a, -a, +a,
 						     +a, -a, -a,
 						     +a, +a, -a,
 						     -a, +a, -a,
 						     +a, -a, -a,
 						     -a, -a, -a,
 						     -a, +a, -a,
 						     -a, +a, +a,
 						     -a, -a, -a,
 						     -a, -a, +a,
 						     -a, +a, -a,
 						     +a, +a, -a,
 						     -a, +a, +a,
 						     +a, +a, +a,
 						     -a, -a, +a,
 						     +a, -a, +a,
 						     -a, -a, -a,
 						     +a, -a, -a
							 ];
	
	this.normalArray = [	    0, 0, 1,
								0, 0, 1,
								0, 0, 1,
								0, 0, 1,
								1, 0, 0,
								1, 0, 0,
								1, 0, 0,
								1, 0, 0,
								0, 0,-1,
								0, 0,-1,
								0, 0,-1,
								0, 0,-1,
							   -1, 0, 0,
							   -1, 0, 0,
							   -1, 0, 0,
							   -1, 0, 0,
							    0, 1, 0,
							    0, 1, 0,
							    0, 1, 0,
							    0, 1, 0,
							    0,-1, 0,
							    0,-1, 0,
							    0,-1, 0,
							    0,-1, 0
								];

	this.indicesArray = [	  0, 2, 1,
							  2, 3, 1,
							  4, 6, 5, 
							  6, 7, 5,
							  8, 10,9,
							  10,11,9,
							  12,14,13, 
							  14,15,13,
							  16,18,17, 
							  18,19,17, 
							  20,22,21, 
							  22,23,21
							  ];
	
	this.cubeShape = e170.createObject("Shape");
	this.cubePrimitive = e170.createObject("Primitive");
	this.streamBank = e170.createObject("StreamBank");
	
	this.cubePrimitive.material = this.cubeMaterial;
	this.cubePrimitive.owner = this.cubeShape;
	this.cubePrimitive.streamBank = this.streamBank;
	
	this.cubePrimitive.primitiveType = e169.Primitive.TRIANGLELIST;
	this.cubePrimitive.numberPrimitives = 12;
	this.cubePrimitive.numberVertices = 24;
	this.cubePrimitive.createDrawElement(e170,null);
	
	this.positionBuffer = e170.createObject("VertexBuffer");
	this.positionField = this.positionBuffer.createField("FloatField",3);
	this.streamBank.setVertexStream(
									e169.Stream.POSITION,
									0,
									this.positionField,
									0);
	this.normalField = this.positionBuffer.createField("FloatField",3);
	this.streamBank.setVertexStream(
									e169.Stream.NORMAL,
									0,
									this.normalField,
									0);
 
    this.positionBuffer.allocateElements(24); 	
	
	this.positionField.setAt(0,this.positionArray);
	this.normalField.setAt(0,this.normalArray);
	
	this.indexBuffer = e170.createObject("IndexBuffer");
	this.indexBuffer.set(this.indicesArray);
	this.cubePrimitive.indexBuffer = this.indexBuffer;
	}

e110.e154.prototype.e226 = function(){
	 this.lightPositionParam.value = e47;
	}
	


var e83 = e83 || {};

e83.e161 = function(){
	if(e40[0]){
		e83.e200(e40);
		}
	}
	
e83.e200 = function(e72){
		if (e72[0])
		   {				 
		   e58.push(e72);
		   var massLength = e72.length;
		 	for (var n=massLength-1;n>=0;n--)
			    {
				 e83.e200(e72[n]);
				 e58[e58.length-1].splice(n,1);
				}			
				e58.pop();
			}
		else 
		{
			e72.transform.parent = null;
			e170.removeObject(e72.transform);
			e72.parent = null;
			e72 = null;
			
		}
	}

e83.e85 = function(stringData){
	e83.e86(stringData);
	view.e10();
	}

e83.e86 = function(stringData){
	var shiftN = 0;
	var n = 0;
	var createN = 0;
	while(n*13+shiftN<stringData.length){
		var label = stringData.substr(n*13+shiftN,1);
		if(label == "["){
			var newMass = new Array;
				newMass.transform = e170.createObject("Transform");
				newMass.transform.parent = e58[e58.length-1].transform;
				newMass.parent = e58[e58.length-1];
				newMass.localX = parseInt(stringData.substr(n*13+shiftN+1,2),36)-648;
				newMass.localY = parseInt(stringData.substr(n*13+shiftN+3,2),36)-648;
				newMass.localZ = parseInt(stringData.substr(n*13+shiftN+5,2),36)-648;
				newMass.x = newMass.localX + newMass.parent.x;
				newMass.y = newMass.localY + newMass.parent.y;
				newMass.z = newMass.localZ + newMass.parent.z;
				newMass.transform.translate(newMass.localX,newMass.localY,newMass.localZ);
			e58[e58.length-1].push(newMass);
			e58.push(newMass);
			shiftN += 8;
			e83.e86(stringData.substr(n*13+shiftN));
			break;
			}
		else if(label == "]"){
			e58.pop();
			shiftN += 1;
			if(!createN && n){
				
				var tempMass = e58[e58.length-1][e58[e58.length-1].length-1];
				e170.removeObject(tempMass.transform);
				tempMass.transform.parent = null;
				tempMass.parent = null;
				e58[e58.length-1].pop();
				}
			}
		else{
			var newCube = e83.e87(stringData.substr(n*13+shiftN,13));
			if(newCube){createN++;}
			n++;
			}
		}
	return newMass;
	}


e83.e87 = function(stringData){
	var newCube = new e110.e109(	e44[0].cubeShape,
										parseInt(stringData.substr(1,2),16)/255,
										parseInt(stringData.substr(3,2),16)/255,
										parseInt(stringData.substr(5,2),16)/255,
										parseInt(stringData.substr(0,1),16)/10,
										parseInt(stringData.substr(7,2),36)-648,
										parseInt(stringData.substr(9,2),36)-648,
										parseInt(stringData.substr(11,2),36)-648,
										1);
			if(newCube.transform){
				e58[e58.length-1].push(newCube);
				return newCube;
				}
	}


e83.e225 = function(){
	e44[0].e226();
	}


var e14 = e14 || {};


e14.init = function(){
	e219 = o3djs.material.createMaterialFromFile(e170,
															 materialUrls[0],
															 e5.zOrderedDrawList);
	e219.getParam("colorMult").value = [1, 1, 1, 1];
	e219.drawList = e5.zOrderedDrawList;
	e44[5] = o3djs.primitives.createPlane(e170,
												e219,
												1,
												1,
												1,
												1,
												[[1, 0, 0, 0],
												[0, 0, 1, 0],
												[0,-1, 0, 0],
												[0, 0, 0, 1]]);
	var repectTexture = e14.e15([[1,1,1,1],[0.5,0.6,0.8,1]],10,700,"upToDown");
	
	for(var n=0;n<100;n++){
		e43[n] = new e14.e16("chips0",[],[repectTexture],[],[]);
		e43[n].e122(n*10,0);
		e43[n].changeZ(-500);
		}
	}
	
e14.e15 = function(color,width,height,e196){
	
			var bgColorTexture = e170.createTexture2D(
														 width,
														 height,
														 o3djs.base.o3d.Texture.ARGB8,
														 1,
														 false);
			
			var linearPaint = e170.createObject("CanvasPaint");

			
			var bgImageCanvas = e170.createObject("Canvas");
			bgImageCanvas.setSize(width,height);
			
			if(color[0][0] != undefined){
				bgImageCanvas.clear([0,0,0,0]);
				var gradientShader = e170.createObject("CanvasLinearGradient");
				switch(e196){
					case "leftToRight":
						gradientShader.startPoint = [-1, 0];
						gradientShader.endPoint = [width-1, 0];
						break;
					case "rightToLeft":
						gradientShader.startPoint = [width-1, 0];
						gradientShader.endPoint = [-1, 0];
						break;
					case "downToUp":
						gradientShader.startPoint = [0, height-1];
						gradientShader.endPoint = [0, -1];
						break;
					case "upToDown":
						gradientShader.startPoint = [0, 0];
						gradientShader.endPoint = [0, height];
						break;
					default :
						gradientShader.startPoint = [0, 0];
						gradientShader.endPoint = [width, 0];
						break;
					}
					gradientShader.colors = color;
					gradientShader.positions = [];
					gradientShader.tileMode = e169.CanvasShader.REPEAT;
				linearPaint.shader = gradientShader;
				bgImageCanvas.drawRect(0,0,width,height,linearPaint);
				}
			else{
				bgImageCanvas.clear(color);
				}
			bgColorTexture.drawImage(bgImageCanvas,0,height-1,width,-height,
									   0,0,0,width,height
									   );	
			return bgColorTexture;
	}

	
	
e14.e16 = function(name,text,e249,e239,e227,e224){
	this.name = name;
	this.x = 0;
	this.y = 0;
	this.z = e224 == undefined ? 0 : e224;
	
	this.textContent = text[0];
	this.textCoordinateX = text[1] ? text[1] : 0;
	this.textCoordinateY = text[2] ? text[2] : 0;
	this.textTypeface = text[3] ? text[3] : "Microsoft YaHei";
	this.textSize = text[4] ? text[4] : 10;
	this.textColor = text[5] ? text[5] : [0,0,0,1];
	this.e234 = text[6] ? text[6] : 99999999;
	
	this.bgImageTexture = e249[0];
	this.e261 = e249[1] != undefined ? e249[1] : 1;
	this.e259 = e249[2];
	this.e260 = e249[3];
	
	this.e239 = e239[0];
	this.e232 = e239[1];
	this.e233 = e239[2];
	this.e231 = e239[3];
	
	if(e227["activeDown"]){
		this.activeDown = e227["activeDown"];
		}
		else{
			this.activeDown = function(){};
			}
			
	if(e227["activeOver"]){
		this.activeOver = e227["activeOver"];
		}
		else{
			this.activeOver = function(){};
			}
			
	if(e227["activeUp"]){
		this.activeUp = e227["activeUp"];
		}
		else{
			this.activeUp = function(){};
			}
	if(e227["activeDrag"]){
		this.activeDrag = e227["activeDrag"];
		}
		else{
			this.activeDrag = function(){};
			}
	if(e227["activeLeave"]){
		this.activeLeave = e227["activeLeave"];
		}
		else{
			this.activeLeave = function(){};
			}
	
	if(e227["defultFunction"]){
		this.defultFunction = e227["defultFunction"];
		}
		else{
			this.defultFunction = function(){};
		}
			
	this.transform = e170.createObject("Transform");
	this.transform.parent = e43.transform;
	this.e244 = e170.createObject("Transform");
	this.e244.parent = this.transform;
	
	this.transform.translate(0,0,this.z);
	
	if(this.bgImageTexture){
		this.e229 = e170.createObject("Transform");
		this.e229.parent = this.e244;
		
		this.bgImageTransform = e170.createObject("Transform");
		this.bgImageTransform.parent = this.e229;
		
		this.bgImageSampler = e170.createObject("Sampler");
		this.bgImageSampler.addressModeU = e169.Sampler.CLAMP;
		this.bgImageSampler.addressModeV = e169.Sampler.CLAMP;
		
		this.bgImageParamSampler = this.bgImageTransform.createParam("texSampler0",
														"ParamSampler");
		this.bgImageParamSampler.value = this.bgImageSampler;
		this.bgImageParamColorMult = this.bgImageTransform.createParam("colorMult",
														"ParamFloat4");
		
		this.bgImageParamColorMult.set(1, 1, 1, this.e261);
		
		this.bgImageSampler.texture = this.bgImageTexture;
		this.bgImageTransform.addShape(e44[5]);	
		
			if(this.e259 && this.e260){
				this.width = this.e259;
				this.height = this.e260;
				}
			else{
				this.width = this.bgImageTexture.width;
				this.height = this.bgImageTexture.height;
				}
		this.bgImageTransform.translate(this.width/2,this.height/2,0);
		this.bgImageTransform.scale(this.width,-this.height,1);
		
		
		}
		else if(this.e239  && this.e239[0] != undefined){
			this.width = this.e232;
			this.height = this.e233;
			
			this.e229 = e170.createObject("Transform");
			this.e229.parent = this.e244;
			
			this.bgImageTransform = e170.createObject("Transform");
			this.bgImageTransform.parent = this.e229;
			
			this.bgColorTexture = e170.createTexture2D(
														 this.width,
														 this.height,
														 o3djs.base.o3d.Texture.ARGB8,
														 1,
														 false);
			
			var linearPaint = e170.createObject("CanvasPaint");

			
			this.bgImageCanvas = e170.createObject("Canvas");
			this.bgImageCanvas.setSize(this.width,this.height);
			
			if(this.e239[1][0] != undefined){
				this.bgImageCanvas.clear([0,0,0,0]);
				var gradientShader = e170.createObject("CanvasLinearGradient");
				switch(this.e231){
					case "leftToRight":
						gradientShader.startPoint = [-1, 0];
						gradientShader.endPoint = [this.width-1, 0];
						break;
					case "rightToLeft":
						gradientShader.startPoint = [this.width-1, 0];
						gradientShader.endPoint = [-1, 0];
						break;
					case "downToUp":
						gradientShader.startPoint = [0, this.height-1];
						gradientShader.endPoint = [0, -1];
						break;
					case "upToDown":
						gradientShader.startPoint = [0, 0];
						gradientShader.endPoint = [0, this.height];
						break;
					default :
						gradientShader.startPoint = [0, 0];
						gradientShader.endPoint = [this.width, 0];
						break;
					}
					gradientShader.colors = this.e239;
					gradientShader.positions = [];
					gradientShader.tileMode = e169.CanvasShader.REPEAT;
				linearPaint.shader = gradientShader;
				this.bgImageCanvas.drawRect(0,0,this.width,this.height, linearPaint);
				}
			else{
				this.bgImageCanvas.clear(this.e239);
				}
			this.bgColorTexture.drawImage(this.bgImageCanvas,0,this.height-1,this.width,-this.height,
									   0,0,0,this.width,this.height
									   );
			this.bgImageSampler = e170.createObject("Sampler");
			this.bgImageSampler.addressModeU = e169.Sampler.CLAMP;
			this.bgImageSampler.addressModeV = e169.Sampler.CLAMP;
			
			this.bgImageParamSampler = this.bgImageTransform.createParam("texSampler0",
															"ParamSampler");
			this.bgImageParamSampler.value = this.bgImageSampler;
			this.bgImageParamColorMult = this.bgImageTransform.createParam("colorMult",
															"ParamFloat4");
			this.bgImageParamColorMult.set(1, 1, 1, 1);
				
			this.bgImageSampler.texture = this.bgColorTexture;
			this.bgImageTransform.addShape(e44[5]);	
			
			this.bgImageTransform.translate(this.width/2,this.height/2,0);
			this.bgImageTransform.scale(this.width,-this.height,1);
			
			}
			else if(this.e239 == undefined){
				this.width = this.e232;
				this.height = this.e233;
				}
	
	if(this.textContent){
		this.textMoveTransform = e170.createObject("Transform");
		this.textMoveTransform.parent = this.e244;
		
		this.textTransform = e170.createObject("Transform");
		this.textTransform.parent = this.textMoveTransform;
		
		
		this.textPaint = e170.createObject("CanvasPaint");
		this.textPaint.color = this.textColor;
		this.textPaint.textSize = this.textSize;
		this.textPaint.textTypeface = this.textTypeface;
		var fontBox = this.textPaint.measureText(this.textContent);
		this.textWidth = fontBox[2]-fontBox[0];
		this.textHeight = fontBox[3]-fontBox[1];
			if(this.textWidth>this.e234){
				
				var writeInRows = true;
				var splitText = e210.e211(this.textPaint,this.textContent,this.e234);
				fontBox = this.textPaint.measureText(splitText[0]);
				this.textWidth = this.e234;
				this.textHeight = (fontBox[3]-fontBox[1]+3)*splitText.length;
				}
		
		if (this.textHeight%2 != 0){this.textHeight = this.textHeight +1;}
		if (this.textWidth %2 != 0){this.textWidth = this.textWidth +1;}
		
		this.textTexture = e170.createTexture2D(
													 this.textWidth,
													 this.textHeight,
													 o3djs.base.o3d.Texture.ARGB8,
													 1,
													 false);
		this.textCanvas = e170.createObject("Canvas");
		this.textCanvas.setSize(this.textWidth,this.textHeight);
		this.textCanvas.clear([1,1,1,0]);
		this.textTexture.drawImage(this.textCanvas,0,this.textHeight-1,this.textWidth,-this.textHeight,
								   0,0,0,this.textWidth,this.textHeight
								   );
		
			if(writeInRows){
				for(var nRows=0;nRows<splitText.length;nRows++){
					this.textCanvas.drawText(splitText[nRows],
										 -fontBox[0],
										 (fontBox[3]-fontBox[1])*(nRows+1)-fontBox[3]+nRows*3,
										 this.textPaint);
					}
				}
			else{
				this.textCanvas.drawText(this.textContent,
									 -fontBox[0],
									 this.textHeight-fontBox[3],
									 this.textPaint);
				}
		
		this.textTexture.drawImage(this.textCanvas,0,this.textHeight-1,this.textWidth,-this.textHeight,
								   0,0,0,this.textWidth,this.textHeight
								   );
		this.textSampler = e170.createObject("Sampler");
		this.textSampler.addressModeU = e169.Sampler.CLAMP;
		this.textSampler.addressModeV = e169.Sampler.CLAMP;
		
		this.textParamSampler = this.textTransform.createParam("texSampler0",
														"ParamSampler");
		this.textParamSampler.value = this.textSampler;
		this.textParamColorMult = this.textTransform.createParam("colorMult",
														"ParamFloat4");
		
		this.textParamColorMult.set(1, 1, 1, 1);
		
		this.textSampler.texture = this.textTexture;
		this.textTransform.addShape(e44[5]);	
		
		this.textTransform.translate(this.textWidth/2,this.textHeight/2,0.001);
		this.textTransform.scale(this.textWidth,-this.textHeight,1);
		
		if (!this.width){
			this.width = this.textWidth;
		}
		if (!this.height){
			this.height = this.textHeight;
 			}
		
		if (this.textCoordinateX  == "left"){
			this.textMoveTransform.translate(3,0,0);
			}else if (this.textCoordinateX  == "center"){
				this.textMoveTransform.translate(Math.round((this.width - this.textWidth - 3)/2),0,0);
				}else if(this.textCoordinateX  == "right"){
					this.textMoveTransform.translate(this.width - this.textWidth,0,0);
					}else {
						this.textMoveTransform.translate(this.textCoordinateX,0,0);
						}
		if (this.textCoordinateY  == "top"){
			this.textMoveTransform.translate(0,3,0);
			}else if (this.textCoordinateY  == "middle"){
				this.textMoveTransform.translate(0,Math.round((this.height - this.textHeight)/2),0);
				}else if(this.textCoordinateY  == "bottom"){
					this.textMoveTransform.translate(0,this.height - this.textHeight - 3,0);
					}else{
						this.textMoveTransform.translate(0,this.textCoordinateY,0);
						}
		}
	}

e14.e16.prototype.e122 = function(x,y){
	this.x = x;
	this.y = y;
	this.transform.identity();
	this.transform.translate(x,y,this.z);
	
	}
	
e14.e16.prototype.changeZ = function(z){
	this.z = z;
	this.transform.identity();
	this.transform.translate(this.x,this.y,z);
	}
	
